package com.coco.service.impl;
import com.coco.service.PeopleService;
import com.coco.entity.People;
import com.coco.entity.People;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.coco.mapper.PeopleMapper;

@Service
public class PeopleServiceImpl implements PeopleService{

      private PeopleMapper peopleMapper;

      @Autowired
      public PeopleServiceImpl(PeopleMapper peopleMapper) {
             this.peopleMapper = peopleMapper;
}



      @Override
      public List<People> queryPage(Integer pageNo, Integer pageSize) {
             Page<People> page = peopleMapper.selectPage(new Page<>(pageNo, pageSize), new QueryWrapper<People>());
             List<People> recodes = page.getRecords();
             return recodes;
      }


      @Override
      public void add(People people){
             peopleMapper.insert(people);
      }


      @Override
      public void edit(People people){
             peopleMapper.updateById(people);
      }


      @Override
      public void delById(Integer id){
             peopleMapper.deleteById(id);
      }


      @Override
      public People getById(Integer id) {
             return peopleMapper.selectById(id);
      }
}
